package com.asset.dispoal.address.service.commom;

import com.asset.dispoal.address.domain.db.entity.ConvertAreaCode;
import com.asset.dispoal.address.domain.db.mapper.ConvertAreaCodeMapper;
import com.asset.dispoal.address.dto.ConvertAreaCodeRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import tech.mhuang.pacebox.core.ddd.BaseCommand;
import tech.mhuang.pacebox.springboot.core.spring.util.DataUtil;
import tech.mhuang.pacebox.springboot.protocol.Result;

@Component
public class ConvertAreaCodeInsertCommand implements BaseCommand<ConvertAreaCodeRequest, Result> {

    @Autowired
    private ConvertAreaCodeMapper convertAreaCodeMapper;


    @Override
    public Result execute(ConvertAreaCodeRequest area) {
        ConvertAreaCode updateDo = DataUtil.copyTo(area, ConvertAreaCode.class);
        convertAreaCodeMapper.insert(updateDo);
        return Result.ok();
    }
}
